//
//  CZStatusDetailViewController.swift
//  GZWeibo007
//
//  Created by 叶剑龙 on 15/12/24.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

// 统一管理cell的ID
enum CZStatusDetailIdentifier: String {
    case DetailStatusNormalCell = "DetailStatusNormalCell"
    case DetailStatusForwardCell = "DetailStatusForwardCell"
    
    static func cellId(obj: AnyObject) -> String {
        if obj is CZStatus {
            return (obj as! CZStatus).retweeted_status == nil ? DetailStatusNormalCell.rawValue : DetailStatusForwardCell.rawValue
        }
        return DetailStatusNormalCell.rawValue
    }
    
}

class CZStatusDetailViewController: UIViewController {

    // MARK: - 属性 
    private var status: CZStatus
    
    init(status: CZStatus) {
        self.status = status
        
        super.init(nibName: nil, bundle: nil)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = UIColor.redColor()
        
        prepaerUI()
    }
    
    
    func prepaerUI() {
        // 添加子控件
        view.addSubview(bottomView)
        
        
        bottomView.ff_AlignInner(type: ff_AlignType.BottomLeft, referView: view, size: CGSize(width: UIScreen.mainScreen().bounds.width, height: 44))
    }

    
    
    
    
    
    
    
    
    
    /// 点击被转发微博,再弹出一个控制器显示 被转发微博 详情
    func retweetStatusClick(clickStatus: CZStatus) {
        let detailVC = CZStatusDetailViewController(status: clickStatus)
        detailVC.hidesBottomBarWhenPushed = true
        
        navigationController?.pushViewController(detailVC, animated: true)
    }
    
    
    
    
    //MARK - 懒加载
    private lazy var tableView : UITableView = UITableView(frame: CGRectZero, style: UITableViewStyle.Plain)

   
    
    /// 底部View
    private lazy var bottomView: CZStatusBottomView = {
        let view = CZStatusBottomView()
        

        
        return view
    }()
}
